<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
		<link rel="stylesheet" href="../css/iconfont.css">
		<style>
			.mui-content-padded{margin:5px 0 0 0;}
			.mui-row-list span{float: left; line-height:33px; width:20%;}
			.mui-row-list select{float: left; line-height:14px; font-size:14px; margin-top:2px; margin-left: 5px;}
			.mui-btn-block{margin-bottom:0; padding:6px;}
			.mui-col-sm-12{ border-top: 1px solid #D1D1D1; width:100%; padding-top:5px; font-size:14px;}
			input[type="text"]{height:30px; margin-bottom: 5px;}
			input[readonly="readonly"]{ text-align: left; padding-left: 5px; padding-right: 0;}
			input{border-width: 0; height: 26px; float: right; text-align: right; padding-right: 15px;}
			form:before{ background: none !important; border: none !important;}
			.mui-switch:before {content: '否'; color: #999;}
			.mui-switch.mui-active:before {content: '是'; color: #fff;}
			.mui-switch.two:before {content: '正常'; color: #999;}
			.mui-switch.two.mui-active.two:before {content: '撤销'; color: #fff;}
			.mui-table-view-cell.mui-active{ display:block;}
			.border0{border-width: 0; border-bottom: #dddddd 1px solid;}
			.ui-alert{font-size: 14px;}
			#Popup {
				width: 0px;
				height: 0px;
				background: red;
				position: fixed;
				top: 70%;
				left: 50%;
			}
			.mui-popover{
				width: 300px;
			}
			.mui-popover .mui-popover-arrow:after {
				width: 0px;
			}
			.mui-switch{
				border-color: #fd933b;
				background-color: #fd933b;
				border-width: 1px;
			}
			.mui-switch:before {content: '选择'; color: #fff; right: 10px;}
			.mui-switch.mui-active:before {content: '填写'; color: #fff; left: 10px;}
			.mui-switch.mui-active {
				border-color: #007AFF;
				background-color: #007AFF;
			}
			.popover-cont ul{
				margin-top: 5px; 
				margin: 0; 
				padding: 0; 
				list-style: none; 
				background: #ffffff;
			}
			.table{
				width: 100%;
			}
			.thead{
				width: 100%;
				border: 1px solid #007AFF;
			}
			.thead tr{
				 width: 100%; 
				 background-color: #007AFF;
				 height: 20px;
			}
			.thead tr th{
				color: #ffffff;
				border-right: 1px solid #ffffff;
				text-align: center;
				font-family: "microsoft yahei";
				font-size: 14px;
				line-height: 20px;
			}
			.tbody{
				width: 100%;
				border: 1px solid #007AFF;
			}
			.tbody tr{
				 width: 100%; 
				 height: 20px;
			}
			.tbody tr td{
				color: #000;
				border: 1px solid #007AFF;
				text-align: center;
				font-family: "microsoft yahei";
				font-size: 14px;
				line-height: 20px;
			}
			.div-tab{
				width: 100%; 
				height: 200px; 
				overflow-y: scroll;
			}
			.div-tab::-webkit-scrollbar {
				display: none;
			}
			.submit{
				margin:0 auto 10px auto; 
				width:200px; 
				height:35px; 
				line-height: 35px; 
				background-color:#007AFF; 
				text-align: center; 
				color: #FFFFFF; 
				border-radius: 10px;
			}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" id="high_id">肺结核专档</h1>
		</header>
		<div class="mui-conten" style="margin-top:50px;">
			<ul class="mui-table-view">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<a style="float: left; font-size: 14px; width: 60px; line-height: 26px;">姓名</a>
							<input  id='name-1' class="ui-alert border0" readonly="readonly" placeholder="" style="width:70px; float: left;"/>
							<a style="float: left; font-size: 14px; width: 60px; line-height: 26px; margin-left: 5px;">性别</a>
							<input  id='sex-1' class="ui-alert border0" readonly="readonly" placeholder="" style="width:30px; float: left;"/>
							<a style="float: left; font-size: 14px; width: 60px; line-height: 26px; margin-left: 5px;">年龄</a>
							<input  id='age-1' class="ui-alert border0" readonly="readonly" placeholder="" style="width:40px; float: left;"/>
						</li>
						<li class="mui-table-view-cell">
							<a style="float: left; font-size: 14px; width: 90px; line-height: 26px;">家庭住址</a>
							<input  id='ad-1' class="ui-alert border0" readonly="readonly" placeholder="" style="width:210px; float: left;"/>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">确诊时间</div>
								<input  id='result0' class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}'>
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">确诊医生</div>
								<input  id='doc' class="ui-alert border0"  placeholder="" style="float: right; width:50%;"/>
							</a>
						</li>
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}'>
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">确诊医院</div>
								<input  id='hosp' class="ui-alert border0"  placeholder="" style="float: right; width:50%;"/>
							</a>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">肺结核类型</div>
								<input  id='result1' class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">状态</div>
								<input  id='result2' class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
						<li class="mui-table-view-cell" id="stop1" style="display: none;">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">停止治疗时间</div>
								<input  id='result3' class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
						<li class="mui-table-view-cell" id="stop2" style="display: none;">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">停止治疗原因</div>
								<input  id='result4' class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
					</div>
				</div>
			</ul>
			<div style="margin-left:0.9rem; line-height:35px;">全程管理情况</div>
			<ul class="mui-table-view">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<div style="float: left; font-size: 14px; line-height: 22px; margin-right: 5px;">应访问患者</div>
							<input  id='request' class="ui-alert border0"  placeholder="" style="width:40px; float: left;"/>
							<a style="float: left; font-size: 14px; margin: 0 5px; padding: 0; line-height: 22px;">次,实际访视</a>
							<input  id='real' class="ui-alert border0"  placeholder="" style="width:40px; float: left;"/>
							<a style="float: left; font-size: 14px; margin: 0 5px; padding: 0; line-height: 22px;">次</a>
						</li>
						<li class="mui-table-view-cell">
							<div style="width: 100%; float: left; margin-bottom: 10px;">
								<div style="float: left; font-size: 14px; line-height:35px; margin-right: 5px;">患者在治疗过程中</div>
								<div style="float: left; width: 100%; line-height: 35px;">
									<span style="float: left;">应服药</span>
									<div style="float: right; font-size: 14px; margin: 0 5px; padding: 0; line-height: 22px;">次</div>
									<input  id='requestDrugTimes' class="ui-alert border0"  placeholder="" style="width:80px; float: right;"/>
								</div>
								<div style="float: left; width: 100%; line-height: 35px;">
									<span style="float: left;">实际服药</span>
									<div style="float: right; font-size: 14px; margin: 0 5px; padding: 0; line-height: 22px;">次</div>
									<input  id='realDrugTimes' class="ui-alert border0"  placeholder="" style="width:80px; float: right;"/>
								</div>
								<div style="float: left; width: 100%; line-height: 35px;">
									<span style="float: left;">服药率</span>
									<div style="float: right; font-size: 14px; margin: 0 5px; padding: 0; line-height: 22px;">%</div>
									<input id='efficiency' class="ui-alert border0" readonly="readonly" placeholder="" style="width:80px; float: right; text-align: center;"/>
								</div>
							</div>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<div style="float: left; font-size:16px;">随访医生签名</div>
							<div class="mui-switch" id="mySwitch3">
							  <div class="mui-switch-handle"></div>
							</div>
						</li>
						<li class="mui-table-view-cell" id="tigshow_doc_1">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<input id='result5' class="ui-alert"  placeholder="请选择" style="width:50%; text-align: right; float: right; padding-right: 15px;"/>
							</a>
							<!-- <div style="display: none; margin-top:10px; text-align: right;" id="tigshow_drug">
								<button id="popbtm">添加省内其他院的随访医生</button>
							</div> -->
						</li>
						<li class="mui-table-view-cell" style="display: none;" id="tigshow_doc_2">
							<div style="float: left; width:100%;">
								<div style="float: left; font-size: 16px; width:5rem; text-align:center;">医院</div>
								<input id='text-doc' class="ui-alert bottom_soild"  placeholder="请输入" style="width:60%; margin-left: 6px;"/>
							</div>
							<div style="float: left; width:100%;">
								<div style="float: left; font-size: 16px; width:5rem; text-align:center;">医生</div>
								<input id='text-hosp' class="ui-alert bottom_soild"  placeholder="请输入" style="width:60%; margin-left: 6px;"/>
							</div>
						</li>
					</div>
				</div>
			</ul>
			<ul style="padding:10px 15px; margin: 0;">
				<p style="color: red; margin: 0;">
					提示：
					</br>
					若随方医生是省外的，则使用“填写”方式，手工输入随方医生信息。
					</br>
					若随方医生是省内的，则使用“选择”方式，选择对应医院和随方医生。
				</p>
			</ul>
			<div onclick="submit()" class="submit" >提交</div>
		</div>
		<!-- 弹窗 -->
		<!-- <div id="Popup"></div>
		<div id="popover" class="mui-popover" style="height: 500px; background-color: #efeff4;">
			<div style="height: 30px; background-color: #007AFF; border-radius: 7px 7px 0 0; text-align: center;">
				<b style="color: #ffffff; line-height: 30px; font-family: "微软雅黑"; font-size: 16px;">添加随方医生</b>
			</div>
			<div class="popover-cont">
				<ul style="margin: 5px 0; padding: 10px;float: left;">
					<li>
						<div style="float: left; margin-bottom: 10px;">
							<div style="float: left; font-size: 14px; width: 70px; line-height: 26px;">医院名称</div>
							<input  id='add-doc' class="ui-alert border0"  placeholder="" style="width:210px;"/>
						</div>
						<div style="float: left; width: 200px;">
							<div style="float: left; font-size: 14px; width: 70px; line-height: 26px;">医生姓名</div>
							<input  id='add-hosp' class="ui-alert border0"  placeholder="" style="float: left; width:130px;"/>
						</div>
						<div style="float: right; width: 60px;">
							<button style="height:26px; width: 60px; padding: 0; line-height: 26px; color: #ffffff; background-color: #007AFF; border-radius: 10px;">确定</button>
						</div>
					</li>
				</ul>	
				<div style="height: 26px; font-size: 16px; line-height: 26px; float: left; margin-left: 10px;">检索医院</div>
				<ul style="margin: 5px 0; padding: 10px;float: left;">
					<li>
						<a class="btn" style="float: left; margin-bottom: 10px; color:#000;">
							<div style="float: left; font-size: 14px; width: 70px; line-height: 26px;">地区</div>
							<input  id='result6' class="ui-alert"  placeholder="请选择" style="float: left; width:150px; text-align: left;"/>
						</a>
						<div style="float: left; width: 210px;">
							<div style="float: left; font-size: 14px; width: 70px; line-height: 26px;">医院</div>
							<input id='ser-hosp' class="ui-alert border0"  placeholder="" style="float: left; width:120px;"/>
						</div>
						<div style="float: right; width: 60px;">
							<button style="height:26px; width: 60px; padding: 0; line-height: 26px; color: #ffffff; background-color: #007AFF; border-radius: 10px;">查询</button>
						</div>
						<div style="float: left; width: 100%; margin: 10px 0 0 0;">
							<p style="color: red; margin: 0;">双击查询结果列表中所选定的医院，即可完成医院选择。</p>
						</div>
						<div class="div-tab" style="">
						<table class="table">
							<thead class="thead">
								<tr>
									<th>序号</th>
									<th>医院名称</th>
									<th>医院地址</th>
									<th>医院级别</th>
								</tr>
							</thead>
							<tbody  class="tbody">
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
								<tr>
									<td>haha</td>
									<td>ertert</td>
									<td>cvcv</td>
									<td>hjkyui</td>
								</tr>
							</tbody>
						</table>
						</div>
					</li>
				</ul>	
			</div>
		</div> -->
		<script src="../js/mui.js"></script>
		<script src="../js/mui.picker.min.js"></script>
		<script src="../js/jquery.min-1.11.1.js"></script>
		<script type="text/javascript">
			var resultall = {"r1":["","原发性肺结核","行播散性肺结核","浸润型肺结核","继发性肺结核"],
							"r2":["","管理中","结案"],
							"r3":["","完成疗程","死亡","丢失","转入耐多药治疗"]}
			var tbId = 0;
			var ehrId = null;
			var diagnoseDate = null;
			var diagnoseHosp = null;
			var diagnoseDoctor = null;
			var tbType = null;
			var manageState = null;
			var closeDate = "";
			var closeReason = null;
			var requestVisitTimes = null;
			var realVisitTimes = null;
			var requestDrugTimes = null;
			var realDrugTimes = null;
			var doctorId = "";
			var createDate = null;
			var createUserid = null;
			var modifyDate = null;
			var modifyUserid = null;
			var doctorName = "";
			var doctorHospName = "";
			var doctorHospId = "";
			var createHospId = "";
			//获取变量
			var date1 = new Date();
			var year1=date1.getFullYear(); 
			var month1=date1.getMonth()+1;
			var day1=date1.getDate();
			var h1=date1.getHours();
			var m1=date1.getMinutes();
			var s1=date1.getSeconds();
				month1 =(month1<10 ? "0"+month1:month1); 
				day1 =(day1<10 ? "0"+day1:day1); 
				h1 =(h1<10 ? "0"+h1:h1); 
				m1 =(m1<10 ? "0"+m1:m1); 
				s1 =(s1<10 ? "0"+s1:s1);
				modifyDate = (year1.toString()+'-'+month1.toString()+'-'+day1.toString()+' '+h1.toString()+':'+m1.toString()+':'+s1.toString())
				createDate = (year1.toString()+'-'+month1.toString()+'-'+day1.toString()+' '+h1.toString()+':'+m1.toString()+':'+s1.toString());
			var self = localStorage.getItem("name")
			var data = JSON.parse(self)
			doctorName = data.obj.userName;//责任(评估)医生名字
			doctorId = data.obj.id;//责任(评估)医生id
			doctorHospId = data.obj.hospId;//责任(评估)医生医院id
			createHospId = data.obj.hospId;//创建医院id
			doctorHospName = data.obj.hospName;//责任(评估)医生医院名称
			createUserid = data.obj.id;//创建人id
			modifyUserid = data.obj.id;//修改人id
			var listdata = "";
			var selfdata = "";
			var dated;
			var dateov;
			var newdate = new Date();
			mui.plusReady(function(){
				var self = plus.webview.currentWebview()
					listdata = self.data
					selfdata = JSON.parse(listdata)
					ehrId = selfdata.ehrId
				document.getElementById("name-1").value = selfdata.name;
				document.getElementById("sex-1").value = selfdata.sex;
				document.getElementById("age-1").value = self.age;
				document.getElementById("ad-1").value = selfdata.homeAddress;
				mui.ajax('http://192.168.2.64:8089/mobile/ehr/Tb/get',{
					data:{
						"ehr_id":ehrId
					},
					dataType:'json',//服务器返回json格式数据
					type:'post',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					success:function(data){
						var rows = data.rows;
						var haha = JSON.stringify(data)
						console.log(haha)
						if (data.status == 1) {
							if(rows != ""){
							tbId = rows[0].tbId;
							ehrId = rows[0].ehrId;
							//确诊时间
								dated = new Date(rows[0].diagnoseDate);
							var yeard=dated.getFullYear(); 
							var monthd=dated.getMonth()+1;
							var dayd=dated.getDate();
								monthd =(monthd<10 ? "0"+monthd:monthd); 
								dayd =(dayd<10 ? "0"+dayd:dayd); 
							diagnoseDate = (yeard.toString()+'-'+monthd.toString()+'-'+dayd.toString());
							document.getElementById("result0").value = diagnoseDate;
							document.getElementById("doc").value = rows[0].diagnoseDoctor;//确诊医院
							document.getElementById("hosp").value = rows[0].diagnoseHosp;//确诊医生
							var rowstbType=new Array("","原发性肺结核","行播散性肺结核","浸润型肺结核","继发性肺结核")
							document.getElementById("result1").value = rowstbType[rows[0].tbType];
							console.log(rows[0].manageState)
							var rowsmanageState=new Array("","管理中","结案")
							document.getElementById("result2").value = rowsmanageState[rows[0].manageState];
							if(rows[0].manageState != "2"){
								document.getElementById("stop1").style.display = "none";
								document.getElementById("stop2").style.display = "none";
							}else{
								document.getElementById("stop1").style.display = "block";
								document.getElementById("stop2").style.display = "block";
							}
							//停止治疗时间
							if(rows[0].closeDate != null){
								var datec = new Date(rows[0].closeDate);
								var yearc=datec.getFullYear(); 
								var monthc=datec.getMonth()+1;
								var dayc=datec.getDate();
									monthc =(monthd<10 ? "0"+monthc:monthc); 
									dayc =(dayc<10 ? "0"+dayc:dayc); 
								closeDate = (yearc.toString()+'-'+monthc.toString()+'-'+dayc.toString());
							}
							document.getElementById("result3").value = closeDate; 
							var rowscloseReason=new Array("","完成疗程","死亡","丢失","转入耐多药治疗")
							document.getElementById("result4").value = rowscloseReason[rows[0].closeReason];//停止治疗原因
							document.getElementById("request").value = rows[0].requestVisitTimes;//应访视患者次数
							document.getElementById("real").value = rows[0].realVisitTimes;//实际访视患者次数
							document.getElementById("requestDrugTimes").value = rows[0].requestDrugTimes;//应服药次数
							document.getElementById("realDrugTimes").value = rows[0].realDrugTimes;//时间服药次数
							var datecr = new Date(rows[0].createDate);//创建日期
							var yearcr=datecr.getFullYear(); 
							var monthcr=datecr.getMonth()+1;
							var daycr=datecr.getDate();
							var hcr=datecr.getHours();
							var mcr=datecr.getMinutes();
							var scr=datecr.getSeconds();
								monthcr =(monthcr<10 ? "0"+monthcr:monthcr); 
								daycr =(daycr<10 ? "0"+daycr:daycr); 
								hcr =(hcr<10 ? "0"+hcr:hcr); 
								mcr =(mcr<10 ? "0"+mcr:mcr); 
								scr =(scr<10 ? "0"+scr:scr);
								createDate = (yearcr.toString()+'-'+monthcr.toString()+'-'+daycr.toString()+' '+hcr.toString()+':'+mcr.toString()+':'+scr.toString())
							createUserid = rows[0].createUserid;//创建人id
							doctorId = rows[0].doctorId;//责任(评估)医生id
							doctorName = rows[0].doctorName;
							doctorHospName = rows[0].doctorHospName;
							document.getElementById("result5").value = doctorHospName+doctorName; 
							doctorHospId = rows[0].doctorHospId;
							createHospId =rows[0].createHospId;
							}
						} else {
							
						}
					},
					error:function(xhr,type,errorThrown){
						
					}
				});	
			});	
			requestDrugTimes = document.getElementById("requestDrugTimes");
			realDrugTimes = document.getElementById("realDrugTimes");
			var efficiency = document.getElementById("efficiency");
			requestDrugTimes.addEventListener('input',function(){
				efficiency.value = realDrugTimes.value / requestDrugTimes.value * 100;
			});
			realDrugTimes.addEventListener('input',function(){
				efficiency.value = realDrugTimes.value / requestDrugTimes.value * 100;
			});
			mui.init()
				(function($) {
				$.init();
				var result = $('#result')[0];
				var btns = $('.btn');
				btns.each(function(i, btn) {
					btn.addEventListener('tap', function() {
						var _self = this;
						if(_self.picker) {
							_self.picker.show(function (rs) {
								result.innerText = rs.text;
								_self.picker.dispose();
								_self.picker = null;
							});
						} else {
							if(i == 0){
								var optionsJson = this.getAttribute('data-options') || '{}';
								var options = JSON.parse(optionsJson);
								var id = this.getAttribute('id');
								_self.picker = new $.DtPicker(options);
								_self.picker.show(function(rs) {
									$('#result'+i)[0].value = rs.text;
									_self.picker.dispose();
									_self.picker = null;
								});
							}else if(i == 1){
								var picker = new mui.PopPicker();
								 picker.setData([{value:'1',text:'原发性肺结核'},{value:'2',text:'行播散性肺结核'},{value:'3',text:'浸润型肺结核'},{value:'4',text:'继发性肺结核'}]);
								 picker.show(function (selectItems) {
									 $('#result'+i)[0].value = selectItems[0].text;
								  })
							}else if(i == 2){
								var picker = new mui.PopPicker();
								 picker.setData([{value:'1',text:'管理中'},{value:'2',text:'结案'}]);
								 picker.show(function (selectItems) {
									 $('#result'+i)[0].value = selectItems[0].text;
									 if(selectItems[0].value != "2"){
										$('#result3')[0].value ="";
										$('#result4')[0].value ="";
										document.getElementById("stop1").style.display = "none";
										document.getElementById("stop2").style.display = "none";
									 }else{
										document.getElementById("stop1").style.display = "block";
										document.getElementById("stop2").style.display = "block";
									 }
								  })
							}else if(i == 3){
								var optionsJson = this.getAttribute('data-options') || '{}';
								var options = JSON.parse(optionsJson);
								var id = this.getAttribute('id');
								_self.picker = new $.DtPicker(options);
								_self.picker.show(function(rs) {
									$('#result'+i)[0].value = rs.text;
									_self.picker.dispose();
									_self.picker = null;
								});
							}else if(i == 4){
								var picker = new mui.PopPicker();
								 picker.setData([{value:'0',text:' '},{value:'1',text:'完成疗程'},{value:'2',text:'死亡'},{value:'3',text:'丢失'},{value:'4',text:'转入耐多药治疗'}]);
								 picker.show(function (selectItems) {
									 $('#result'+i)[0].value = selectItems[0].text;
								});
							}else{
								var optionsJson = this.getAttribute('data-options') || '{}';
								var options = JSON.parse(optionsJson);
								var id = this.getAttribute('id');
								/*
								 * 首次显示时实例化组件
								 * 示例为了简洁，将 options 放在了按钮的 dom 上
								 * 也可以直接通过代码声明 optinos 用于实例化 DtPicker
								 */
								_self.picker = new $.DtPicker(options);
								_self.picker.show(function(rs) {
									/*
									 * rs.value 拼合后的 value
									 * rs.text 拼合后的 text
									 * rs.y 年，可以通过 rs.y.vaue 和 rs.y.text 获取值和文本
									 * rs.m 月，用法同年
									 * rs.d 日，用法同年
									 * rs.h 时，用法同年
									 * rs.i 分（minutes 的第二个字母），用法同年
									 */
									$('#result'+i)[0].value = rs.text;
									/* 
									 * 返回 false 可以阻止选择框的关闭
									 * return false;
									 */
									/*
									 * 释放组件资源，释放后将将不能再操作组件
									 * 通常情况下，不需要示放组件，new DtPicker(options) 后，可以一直使用。
									 * 当前示例，因为内容较多，如不进行资原释放，在某些设备上会较慢。
									 * 所以每次用完便立即调用 dispose 进行释放，下次用时再创建新实例。
									 */
									_self.picker.dispose();
									_self.picker = null;
								});
							}
						}
					}, false);
				});
			})(mui);
			//弹窗
			/* document.getElementById("popbtm").addEventListener("tap", function() {
				//调用隐藏/显示弹出层
				mui("#popover").popover('toggle', document.getElementById("Popup"));
			}) */
			//切换
			document.getElementById("mySwitch3").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("tigshow_doc_1").style.display="none";
					document.getElementById("tigshow_doc_2").style.display="block";
					doctorHospId = "0";//签名医生医院id
					doctorHospName = document.getElementById("text-hosp").value;//签名医生医院名字
					doctorId = "0";//签名医生id
					doctorName = document.getElementById("text-doc").value;//签名医生姓名
				}else{
					document.getElementById("tigshow_doc_1").style.display="block";
					document.getElementById("tigshow_doc_2").style.display="none";
					if(doctorId == ""){
						doctorHospId = "";//签名医生医院id
						doctorHospName = "";//签名医生医院名字
						doctorId = "";//签名医生id
						doctorName = "";//签名医生姓名
					}
				}
			})
			//提交
			function submit(){
				tbId = tbId;
				ehrId = ehrId;
				diagnoseDate = $('#result0')[0].value+" 00:00:00";//确诊日期
				diagnoseHosp =  mui("#hosp")[0].value;//确诊医院
				diagnoseDoctor =  mui("#doc")[0].value;//确诊医生
				tbType1 = $('#result1')[0].value;//肺结核类型
				for(var re=0; re<resultall.r1.length; re++){
					if(tbType1 == resultall.r1[re]){
						tbType = re;
					}
				}
				manageState1 =  $('#result2')[0].value;//状态
				for(var re=0; re<resultall.r2.length; re++){
					if(manageState1 == resultall.r2[re]){
						manageState = re;
					}
				}
				console.log($('#result3')[0].value)
				if($('#result3')[0].value != ""){
					closeDate = $('#result3')[0].value+" 00:00:00";//停止治疗时间
				}else{
					console.log("2")
					closeDate = "";
				}
				closeReason1 =  $('#result4')[0].value;//停止治疗原因
				for(var re=0; re<resultall.r3.length; re++){
					if(closeReason1 == resultall.r3[re]){
						closeReason = re;
					}
				}
				requestVisitTimes =  mui("#request")[0].value;//应访问患者次数
				realVisitTimes = mui("#real")[0].value;//实际访视次数
				requestDrugTimes = mui("#requestDrugTimes")[0].value;//应服药次数
				realDrugTimes = mui("#realDrugTimes")[0].value;//实际服药次数
				dated = new Date($('#result0')[0].value);
				dateov = new Date($('#result3')[0].value);
				if(diagnoseDate == " 00:00:00") {
					alert("请输入确诊时间！");
				}else if(dated > newdate) {
					alert("确诊时间不能超过今天！");
				}else if(diagnoseDoctor == "") {
					alert("请输入确认医生！");
				}else if(diagnoseHosp == "") {
					alert("请输入确诊医院！");
				}else if(manageState == 2 && closeDate == "") {
					alert("请输入停止治疗时间！");
				}else if(closeDate != "" && dated > dateov) {
					alert("确诊时间不能超过停止治疗时间！");
				}else if(manageState == 2 && closeReason == "") {
					alert("请输入停止治疗原因！");
				}else{
						mui.ajax('http://192.168.2.64:8089/mobile/ehr/Tb/addOrUpdate',{
						data:{
							"tbId": tbId,
							"ehrId": ehrId,
							"diagnoseDate": diagnoseDate,//确诊日期
							"diagnoseHosp": diagnoseHosp,//确诊医院
							"diagnoseDoctor": diagnoseDoctor,//确诊医生
							"tbType": tbType,//肺结核类型
							"manageState": manageState,//状态
							"closeDate": closeDate,//停止治疗时间
							"closeReason": closeReason,//停止治疗原因
							"requestVisitTimes": requestVisitTimes,//应访问患者次数
							"realVisitTimes": realVisitTimes,//实际访视次数
							"requestDrugTimes": requestDrugTimes,//应服药次数
							"realDrugTimes": realDrugTimes,//实际服药次数
							"doctorId": doctorId,//签名医生id
							"createDate": createDate,//创建时间
							"createUserid": createUserid,//创建人id
							"modifyDate": modifyDate,//修改时间
							"modifyUserid": modifyUserid,//修改人id
							"doctorName": doctorName,//签名医生姓名
							"doctorHospName": doctorHospName,//签名医生医院名字
							"doctorHospId": doctorHospId,//签名医生医院id
							"createHospId": createHospId//专档创建医院id
						},
						dataType:'json',//服务器返回json格式数据
						type:'post',//HTTP请求类型
						timeout:10000,//超时时间设置为10秒；
						success:function(data){
							if (data.status == 1) {
								alert("成功提交")
							} else {
								alert(data.message);
							}
						},
						error:function(xhr,type,errorThrown){
							
						}
					});
				}
			}
		</script>
	</body>
</html>